import { banneradd, bannerdelete, banneredit, bannerinfo, bannerlist } from "../../utils/request/api.js";
export default {
    bannerlist_a({ commit }, payload) {
        bannerlist(payload).then(res => {
            if (res.code == 200 && res.list) {
                 commit('setbannerlist',res.list)
            }
        })
    },
    banneradd_a({ commit }, payload) {
        banneradd(payload).then(res => {
             commit('setbannerTitle', res)
        })
    },
    bannerdelete_a({ commit }, payload) {
        bannerdelete(payload).then(res => {
            //把操作成功变成删除成功
            if (res.code == 200) {
                commit('setbannerTitle', {...res,msg:"删除成功"})
            }
        })
    },
    bannerinfo_a({ commit }, payload) {
        bannerinfo(payload).then(res => {
            //点击编辑的时候 直接把id添加到bannerinfo上
             commit('setbannerinfo',{...res.list,id:payload})
        })
    },
    banneredit_a({ commit }, payload) {
        banneredit(payload).then(res => {
            //把操作成功变成修改成功
            commit('setbannerTitle',{...res,msg:"修改成功"})
        })
    },
}